package net.hn.hnms.biz.cockpit.controller;


import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.cockpit.domain.vo.RiskAreaVo;
import net.hn.hnms.biz.cockpit.domain.vo.RiskHiddenTroubleVo;
import net.hn.hnms.biz.cockpit.domain.vo.RiskLevelVo;
import net.hn.hnms.biz.cockpit.domain.vo.RiskTypeVo;
import net.hn.hnms.biz.cockpit.service.ISafeCockpitService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(value = "安全驾驶舱", tags = {"安全驾驶舱"})
@RestController
@RequestMapping("/cockpit/safe")
@RequiredArgsConstructor
public class SafeCockpitController {

    private final ISafeCockpitService safeCockpitService;

    @ApiOperation("风险区域")
    @GetMapping("/riskArea")
    @AutoSetMineCode
    public R<List<RiskAreaVo>> getRiskAreaList(String mineCode) {
        return R.ok(safeCockpitService.getRiskAreaList(mineCode));
    }

    @ApiOperation("风险类型")
    @GetMapping("/riskType")
    @AutoSetMineCode
    public R<List<RiskTypeVo>> getRiskTypeList(String mineCode) {
        return R.ok(safeCockpitService.getRiskTypeList(mineCode));
    }

    @ApiOperation("风险等级")
    @GetMapping("/riskLevel")
    @AutoSetMineCode
    public R<RiskLevelVo> getRiskLevelInfo(String mineCode) {
        return R.ok(safeCockpitService.getRiskLevelInfo(mineCode));
    }

    @ApiOperation("隐患月份统计")
    @GetMapping("/monthHiddenTrouble")
    @AutoSetMineCode
    public R<JSONObject> hiddenTrouble(String mineCode) {
        return R.ok(safeCockpitService.getMonthHiddenTrouble(mineCode));
    }

    @ApiOperation("隐患专业统计")
    @GetMapping("/majorHiddenTrouble")
    @AutoSetMineCode
    public R<JSONObject> majorHiddenTrouble(String mineCode) {
        return R.ok(safeCockpitService.getMajorHiddenTrouble(mineCode));
    }

    @ApiOperation("风险隐患分析")
    @GetMapping("/riskHiddenTrouble")
    @AutoSetMineCode
    public R<List<RiskHiddenTroubleVo>> riskHiddenTrouble(String mineCode) {
        return R.ok(safeCockpitService.getRiskHiddenTrouble(mineCode));
    }

}
